//
//  BMRevealController.m
//  IntelligentSunglasses
//
//  Created by bosma on 14-4-18.
//  Copyright (c) 2014年 cn.com.bosma. All rights reserved.
//

#import "BMReveal.h"
#import "JASidePanelController.h"
#import "UIViewController+JASidePanel.h"
#import "BMBaseController.h"
#import "BMRank.h"
#import "BMMain.h"
#import "BMMessage.h"
#import "BMfocus.h"
#import "BMSetting.h"
#import "BMGoals.h"
#import "BMSuggest.h"
#import "BMUserSet.h"
#import "BMExercise.h"
#import "BMLogin.h"
#import "AFNetworking.h"
#import "PAImageView.h"


@interface BMReveal ()
{

    UIViewController *baseViewController;
    UINavigationController *baseNavigationController;
    NSArray *titleArr;//列表名
}
@end

@implementation BMReveal
@synthesize isLogin;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBarHidden = YES;
}

- (void)viewDidLoad
{
	[super viewDidLoad];
    titleArr = @[@"主页",@"附近排行",@"好友关注",@"消息",@"体重与运动量",@"运动目标",@"意见反馈",@"设置"];


    baseNavigationController =nil;
    [self getUserImageView];
    isLogin = NO;
    
    
}



#pragma mark - 方法实现

//头像获取
- (void)getUserImageView{
    CGFloat imageSize = 100.f;
    
    self.view.backgroundColor = [UIColor lightGrayColor];
    PAImageView *avaterImageView = [[PAImageView alloc]initWithFrame:CGRectMake(self.view.bounds.size.width-(imageSize)*3, 20, imageSize, imageSize) backgroundProgressColor:[UIColor whiteColor] progressColor:[UIColor lightGrayColor]];
    [self.view addSubview:avaterImageView];
    
    [avaterImageView setImageURL:@"http://www.sinaimg.cn/qc/photo_auto/chezhan/2012/50/00/15/80046_950.jpg"];
}


//用户设置
- (IBAction)userSetAction:(id)sender
{
    NSLog(@"用户设置");
    self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMLogin alloc] init]];

}

#pragma marl - UITableView Data Source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
	return titleArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
	static NSString *cellIdentifier = @"RevelCell";
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
	NSInteger row = indexPath.row;
    
	if (nil == cell)
	{
		cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier];
	}
    cell.backgroundColor = [UIColor clearColor];
	cell.textLabel.text = titleArr[row];
	return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSInteger row = indexPath.row;
    
    switch (row) {
        case 0:
        {
            self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMMain alloc] init]];

        }
            break;
        case 1:
        {
            self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMRank alloc] init]];

        }
            break;

        case 2:
        {
            self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMFocus alloc] init]];

        }
            break;

        case 3:
        {
            self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMMessage alloc] init]];

        }
            break;

        case 4:
        {
            self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMExercise alloc] init]];
            
        }
            break;

        case 5:
        {
            self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMGoals alloc] init]];

        }
            break;

        case 6:
        {
            self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMSuggest alloc] init]];

        }
            break;
        case 7:
        {
            self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[BMSetting alloc] init]];
 
        }
            break;

            
        default:
            break;
    }
    
}
@end
